package descentFly.app
{
	import UIFree.ObjectEvent;
	import UIFree.controls.uif_arrowbutton;
	import UIFree.uif_Timer;
	import UIFree.uif_app;
	import UIFree.uif_styles;
	
	import UIUtils.uif_util;
	
	import descentFly.app.social.ISocial;
	import descentFly.app.social.df_defSocial;
	import descentFly.df_player;
	import descentFly.df_space;
	import descentFly.df_utils;
	
	import flash.events.Event;
	import flash.events.KeyboardEvent;
	import flash.ui.Mouse;
	
	public class df_baseApp extends uif_app {
		private var _social		: ISocial;
		private var _space		: df_space;
		private var _params		: Object;
		private var _player		: df_player;
		
		public function df_baseApp(a_styles:uif_styles=null) {
			uif_arrowbutton.ARROWINSQUARE = true;
			
			_params = loaderInfo.parameters;
			
			if (!_params.hasOwnProperty('width')) {
				_params.width 	= 1000;
				_params.height 	= 700;
			}
			
			super(a_styles);
			styleClass = 'application';
			resize(_params.width, _params.height);
		}
		
		public function get params(): Object {
			return _params;
		}
		
		protected function initialize(): void {
			_social = createSocial();
			_space 	= createSpace();
			stage.dispatchEvent(new Event(df_events.APP_INIT));
		}
		
		public function get player(): df_player {
			return _player;
		}
		
		public function set player(a_player: df_player): void {
			if (!_player) {
				_player = a_player;
				stage.dispatchEvent(new Event(df_events.SETPLAYER));
				initialize();
			}
		}
		
		public function get space(): df_space {
			return _space;
		}
		
		
		protected function createSpace(): df_space {
			return null;
		}
		
		protected function createSocial(): ISocial {
			return null;
		}
		
		public function get social(): ISocial {
			return _social;
		}
		
	}
}